/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
#include <string.h>
#include <jni.h>
#include "var_jni_utils.h"

jobject getInstance(JNIEnv* env, jclass obj_class)
{
    jmethodID construction_id = env->GetMethodID(obj_class, "<init>", "()V");
    jobject obj = env->NewObject(obj_class, construction_id);
    return obj;
}

extern "C" {
	JNIEXPORT jstring Java_com_zdc_zutil_ZutilJni_stringFromJNI( JNIEnv* env, jobject thiz );
	JNIEXPORT void    Java_com_zdc_zutil_ZutilJni_varTest( JNIEnv* env, jobject thiz, jobject val, jobject dst );
}
JNIEXPORT jstring Java_com_zdc_zutil_ZutilJni_stringFromJNI( JNIEnv* env, jobject thiz )
{
	return env->NewStringUTF( (char *)"HelloJni cpp test");
}
JNIEXPORT void Java_com_zdc_zutil_ZutilJni_varTest( JNIEnv* env, jobject thiz, jobject val, jobject dst )
{
	jclass jvarClass = env->FindClass("com/zdc/zutil/jVar");
	jmethodID setInt_method = env->GetMethodID(jvarClass, "SetInt", "(I)V");
	//env->CallVoidMethod(val, setInt_method, 1233);
	zVar zval;
	jVar2zVar(env, val, jvarClass, zval);
	zVar2jVar(env, dst, jvarClass, zval);
}
